package day04;

import java.util.Scanner;

/**
 * 说明:
 *
 * @author:SuZhongHe
 * @date:2023/2/15
 **/
public class DoWhileDemo {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int num=(int) (Math.random()*1000+1);
        System.out.println(num);
        int gusee;
        int times=0;
        do {
            System.out.println("猜吧");
            gusee=scanner.nextInt();
            times++;
            if (gusee>num){
                System.out.println("猜大了");
            }else if (gusee<num){
                System.out.println("猜小了");
            }else {
                System.out.println("猜对了");
            }
        }while (gusee!=num);
        System.out.println("一共猜了"+times+"次");
    }
}
